<?php
/**
 * Created by PhpStorm.
 * User: sofwu
 * Date: 2019/1/14
 * Time: 下午3:22
 */
namespace App\Http\Transformer;

use App\Model\Ad;
use League\Fractal\TransformerAbstract;

class AdTransformer extends TransformerAbstract
{
    public function transform(Ad $ad)
    {
        return[
            'id'=> $ad->id,
            'ad_name'=> $ad->ad_name,
            'ad_link'=> $ad->ad_link,
            'path'=> env('APP_URL').$ad->getFirstMediaUrl(),
        ];
    }
}